home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d18
/
boost4.arc
/
MBLOCK.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-10-23
|
1KB
|
61 lines
Program Mblock;
{ Demonstrates moving a box around on the screen
using the arrow keys }
uses crt,BOSHARE;
var
x1,x2,x3,
y1,y2,y3 : integer;
c : char;
hit : boolean;
Const
UpAr = #72;
DnAr = #80;
RtAr = #77;
LfAr = #75;
BEGIN
{--- Clear the screen, define & draw the box }
ClrScr;
putstr(h,Center('Use arrow keys to move box - Esc quits',80,' '),1,1,14);
x1 := 1;
y1 := 1;
x2 := 4;
y2 := 4;
x3 := x1;
y3 := y1;
box ( x1,y1,x2,y2,1,14 );
{--- Move box according to arrow keys; quit if Escape }
repeat
hit := true;
c := readkey;
if c = #0 then begin
c := readkey;
case c of
UpAr : if y1 > 1 then
y3 := y3 -1;
DnAr : if y2 < 25 then
y3 := y3 +1;
RtAr : if x2 < 80 then
x3 := x3 +1;
LfAr : if x1 > 1 then
x3 := x3 -1;
else
hit := false;
end;
if hit then begin
MoveBlkr ( x1,y1,x2,y2,x3,y3,14);
x1 := x3;
x2 := x1 + 3;
y1 := y3;
y2 := y1 + 3;
end;
end;
until c = #27;
END.